package cn.luischen.controller.admin;

import java.io.IOException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import cn.luischen.constant.LogActions;
import cn.luischen.constant.WebConst;
import cn.luischen.controller.BaseController;
import cn.luischen.exception.BusinessException;
import cn.luischen.model.UserDomain;
import cn.luischen.service.log.LogService;
import cn.luischen.service.user.UserService;
import cn.luischen.utils.APIResponse;
import cn.luischen.utils.IPKit;
import cn.luischen.utils.TaleUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;

import static org.junit.Assert.*;
import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.*;
import org.junit.Rule;
import org.junit.runner.RunWith;
import org.junit.rules.ExpectedException;
import org.junit.Test;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.modules.junit4.PowerMockRunner;
import org.powermock.reflect.Whitebox;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.mockito.stubbing.Answer;
import java.lang.reflect.Method;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.TypeReference;
import com.alibaba.fastjson.parser.ParserConfig;
import java.util.Map;
import java.util.List;
import com.unitspirit.runtime.*;

/**
 * The class contains tests for the class cn.luischen.controller.admin.AuthController.
*
* @generatedBy UnitSpirit CreateTemplateTestFile4
* @version 1.0.9.11 
*/
@PowerMockIgnore({ "javax.management.*" })
@RunWith(PowerMockRunner.class)
@PrepareForTest({ javax.servlet.http.Cookie.class })
public class AuthController_logout_WGTest {
	@Rule
	public ExpectedException unitspirit_thrown = ExpectedException.none();

	@InjectMocks
	cn.luischen.controller.admin.AuthController unitspirit_fixture;

	@Mock
	cn.luischen.service.user.UserService mock_UserService;
	@Mock
	cn.luischen.service.log.LogService mock_LogService;

	/**
	* @date 2022-01-19 23:05:47
	* @see cn.luischen.controller.admin.AuthController#logout
	* @category null
	* @create by com.unitspirit.stg.gencase.impl.CaseForInjectMockWork.collectCaseForInjectMocks2  
	* @author null  
	*/
	@Test
	public void test_logout_1207_114145_590_2_02() throws Throwable {
		unitspirit_fixture = PowerMockito.spy(unitspirit_fixture);
		//被测函数参数定义/*getParamInitForAbstract*/

		javax.servlet.http.HttpSession HttpSession_p_0 = Mockito
				.mock(javax.servlet.http.HttpSession.class);/*getParamInitForAbstract*/

		javax.servlet.http.HttpServletResponse HttpServletResponse_p_1 = Mockito
				.mock(javax.servlet.http.HttpServletResponse.class);/*getParamInitForAbstract*/

		javax.servlet.http.HttpServletRequest HttpServletRequest_p_2 = Mockito
				.mock(javax.servlet.http.HttpServletRequest.class);
		//成员变量设置

		//返回值定义 
		//该函数无返回值 

		/*getMethodParamInit*/
		/*getParamInitForCommon*/

		String Stringmock8_0 = "login_user";
		javax.servlet.http.Cookie mock_sub_caller_Cookie7 = PowerMockito.mock(javax.servlet.http.Cookie.class);
		/*getMethodParamInit*/
		/*getParamInitForCommon*/

		String Stringinit_7_0 = "S_L_ID";/*getParamInitForCommon*/

		String Stringinit_7_1 = "";/*getMethodParamInit*/
		/*getParamInitForCommon*/

		String Stringmock6_0 = null;/*getMethodParamInit*/
		/*getParamInitForCommon*/

		int intmock5_0 = 0;/*getMethodParamInit*/
		/*getParamInitForCommon*/

		String Stringmock4_0 = "/";/*getMethodParamInit*/
		/*getParamInitForCommon*/

		javax.servlet.http.Cookie Cookiemock3_0 = UnitSpiritGsonUtil.getGson().fromJson(
				"{\"path\":\"/\",\"maxAge\":0,\"name\":\"S_L_ID\",\"httpOnly\":false,\"secure\":false,\"version\":0}",
				javax.servlet.http.Cookie.class);/*getMockResultForReturn*/
		/*getJsonDataReady*/

		Boolean mock_result_Boolean2 = false;
		PowerMockito.doReturn(mock_result_Boolean2).when(unitspirit_fixture)
				.checkData(Mockito.any(javax.servlet.http.HttpServletRequest.class));/*getMethodParamInit*/
		/*getParamInitForCommon*/

		String Stringmock1_0 = "/admin/login";

		PowerMockito.doNothing().when(HttpSession_p_0).removeAttribute(anyString());/*getMockForNewInstance2*/

		PowerMockito.whenNew(javax.servlet.http.Cookie.class).withArguments(anyString(), anyString())
				.thenReturn(mock_sub_caller_Cookie7);
		//anyString(),anyString()
		PowerMockito.doNothing().when(mock_sub_caller_Cookie7).setValue(Mockito.any());
		PowerMockito.doNothing().when(mock_sub_caller_Cookie7).setMaxAge(Mockito.anyInt());
		PowerMockito.doNothing().when(mock_sub_caller_Cookie7).setPath(anyString());
		PowerMockito.doNothing().when(HttpServletResponse_p_1)
				.addCookie(Mockito.any(javax.servlet.http.Cookie.class));/*getInsideMock2*/
		/*generateMockAccessMethod*/

		PowerMockito.doNothing().when(HttpServletResponse_p_1).sendRedirect(anyString());

		unitspirit_fixture.logout(HttpSession_p_0, HttpServletResponse_p_1, HttpServletRequest_p_2);
		assertTrue(true);
	}

	/**
	* @date 2022-01-19 23:05:47
	* @see cn.luischen.controller.admin.AuthController#logout
	* @category null
	* @create by com.unitspirit.stg.gencase.impl.CaseForInjectMockWork.collectCaseForAutowired  
	* @author null  
	*/
	@Test
	public void test_logout_1207_114145_590_2_01() throws Throwable {
		unitspirit_fixture = PowerMockito.spy(unitspirit_fixture);
		//被测函数参数定义/*getParamInitForAbstract*/

		javax.servlet.http.HttpSession HttpSession_p_0 = Mockito
				.mock(javax.servlet.http.HttpSession.class);/*getParamInitForAbstract*/

		javax.servlet.http.HttpServletResponse HttpServletResponse_p_1 = Mockito
				.mock(javax.servlet.http.HttpServletResponse.class);/*getParamInitForAbstract*/

		javax.servlet.http.HttpServletRequest HttpServletRequest_p_2 = Mockito
				.mock(javax.servlet.http.HttpServletRequest.class);
		//成员变量设置

		//返回值定义 
		//该函数无返回值 
		/*getMethodParamInit*/
		/*getParamInitForCommon*/

		String Stringmock8_0 = "login_user";
		javax.servlet.http.Cookie mock_sub_caller_Cookie7 = PowerMockito.mock(javax.servlet.http.Cookie.class);
		/*getMethodParamInit*/
		/*getParamInitForCommon*/

		String Stringinit_7_0 = "S_L_ID";/*getParamInitForCommon*/

		String Stringinit_7_1 = "";/*getMethodParamInit*/
		/*getParamInitForCommon*/

		String Stringmock6_0 = null;/*getMethodParamInit*/
		/*getParamInitForCommon*/

		int intmock5_0 = 0;/*getMethodParamInit*/
		/*getParamInitForCommon*/

		String Stringmock4_0 = "/";/*getMethodParamInit*/
		/*getParamInitForCommon*/

		javax.servlet.http.Cookie Cookiemock3_0 = UnitSpiritGsonUtil.getGson().fromJson(
				"{\"path\":\"/\",\"maxAge\":0,\"name\":\"S_L_ID\",\"httpOnly\":false,\"secure\":false,\"version\":0}",
				javax.servlet.http.Cookie.class);/*getMockResultForReturn*/
		/*getJsonDataReady*/

		Boolean mock_result_Boolean2 = false;
		PowerMockito.doReturn(mock_result_Boolean2).when(unitspirit_fixture)
				.checkData(Mockito.any(javax.servlet.http.HttpServletRequest.class));/*getMethodParamInit*/
		/*getParamInitForCommon*/

		String Stringmock1_0 = "/admin/login";

		PowerMockito.doNothing().when(HttpSession_p_0).removeAttribute(anyString());/*getMockForNewInstance2*/

		PowerMockito.whenNew(javax.servlet.http.Cookie.class).withArguments(anyString(), anyString())
				.thenReturn(mock_sub_caller_Cookie7);
		//anyString(),anyString()
		PowerMockito.doNothing().when(mock_sub_caller_Cookie7).setValue(Mockito.any());
		PowerMockito.doNothing().when(mock_sub_caller_Cookie7).setMaxAge(Mockito.anyInt());
		PowerMockito.doNothing().when(mock_sub_caller_Cookie7).setPath(anyString());
		PowerMockito.doNothing().when(HttpServletResponse_p_1)
				.addCookie(Mockito.any(javax.servlet.http.Cookie.class));/*getInsideMock2*/
		/*generateMockAccessMethod*/

		PowerMockito.doNothing().when(HttpServletResponse_p_1).sendRedirect(anyString());

		unitspirit_fixture.logout(HttpSession_p_0, HttpServletResponse_p_1, HttpServletRequest_p_2);
		assertTrue(true);
	}

	/**
	* @date 2022-01-19 23:05:47
	* @see cn.luischen.controller.admin.AuthController#logout
	* @category null
	* @create by com.unitspirit.stg.gencase.impl.CaseForInjectMockWork.collectCaseForAutowired  
	* @author null  
	*/
	@Test
	public void test_logout_1214_120517_579_2_01() throws Throwable {
		unitspirit_fixture = PowerMockito.spy(unitspirit_fixture);
		//被测函数参数定义/*getParamInitForAbstract*/

		javax.servlet.http.HttpSession HttpSession_p_0 = Mockito
				.mock(javax.servlet.http.HttpSession.class);/*getParamInitForAbstract*/

		javax.servlet.http.HttpServletResponse HttpServletResponse_p_1 = Mockito
				.mock(javax.servlet.http.HttpServletResponse.class);/*getParamInitForAbstract*/

		javax.servlet.http.HttpServletRequest HttpServletRequest_p_2 = Mockito
				.mock(javax.servlet.http.HttpServletRequest.class);
		//成员变量设置

		//返回值定义 
		//该函数无返回值 
		/*getMockResultForReturn*/
		/*getJsonDataReady*/

		Boolean mock_result_Boolean1 = false;
		PowerMockito.doReturn(mock_result_Boolean1).when(unitspirit_fixture)
				.checkData(Mockito.any(javax.servlet.http.HttpServletRequest.class));
		/*getInsideMock2*/
		/*generateMockAccessMethod*/

		unitspirit_fixture.logout(HttpSession_p_0, HttpServletResponse_p_1, HttpServletRequest_p_2);
		assertTrue(true);
	}

	/**
	* @date 2022-01-19 23:05:47
	* @see cn.luischen.controller.admin.AuthController#logout
	* @category null
	* @create by com.unitspirit.stg.gencase.impl.CaseForInjectMockWork.collectCaseForInjectMocks2  
	* @author null  
	*/
	@Test
	public void test_logout_20210609_175420_949_2_02() throws Throwable {
		unitspirit_fixture = PowerMockito.spy(unitspirit_fixture);
		//被测函数参数定义/*getParamInitForAbstract*/

		javax.servlet.http.HttpSession HttpSession_p_0 = Mockito
				.mock(javax.servlet.http.HttpSession.class);/*getParamInitForAbstract*/

		javax.servlet.http.HttpServletResponse HttpServletResponse_p_1 = Mockito
				.mock(javax.servlet.http.HttpServletResponse.class);/*getParamInitForAbstract*/

		javax.servlet.http.HttpServletRequest HttpServletRequest_p_2 = Mockito
				.mock(javax.servlet.http.HttpServletRequest.class);
		//成员变量设置

		//返回值定义 
		//该函数无返回值 

		/*getMethodParamInit*/
		/*getParamInitForCommon*/

		String Stringmock4_0 = "login_user";/*getMethodParamInit*/
		/*getParamInitForCommon*/

		javax.servlet.http.Cookie Cookiemock3_0 = UnitSpiritGsonUtil.getGson().fromJson(
				"{\"path\":\"/\",\"maxAge\":0,\"name\":\"S_L_ID\",\"httpOnly\":false,\"secure\":false,\"version\":0}",
				javax.servlet.http.Cookie.class);/*getMockResultForReturn*/
		/*getJsonDataReady*/

		Boolean mock_result_Boolean2 = false;
		PowerMockito.doReturn(mock_result_Boolean2).when(unitspirit_fixture)
				.checkData(Mockito.any(javax.servlet.http.HttpServletRequest.class));/*getMethodParamInit*/
		/*getParamInitForCommon*/

		String Stringmock1_0 = "/admin/login";

		PowerMockito.doNothing().when(HttpSession_p_0).removeAttribute(anyString());
		PowerMockito.doNothing().when(HttpServletResponse_p_1)
				.addCookie(Mockito.any(javax.servlet.http.Cookie.class));/*getInsideMock2*/
		/*generateMockAccessMethod*/

		PowerMockito.doNothing().when(HttpServletResponse_p_1).sendRedirect(anyString());

		unitspirit_fixture.logout(HttpSession_p_0, HttpServletResponse_p_1, HttpServletRequest_p_2);
		assertTrue(true);
	}

	/**
	* @date 2022-01-19 23:05:47
	* @see cn.luischen.controller.admin.AuthController#logout
	* @category null
	* @create by com.unitspirit.stg.gencase.impl.CaseForInjectMockWork.collectCaseForAutowired  
	* @author null  
	*/
	@Test
	public void test_logout_20210609_175420_949_2_01() throws Throwable {
		unitspirit_fixture = PowerMockito.spy(unitspirit_fixture);
		//被测函数参数定义/*getParamInitForAbstract*/

		javax.servlet.http.HttpSession HttpSession_p_0 = Mockito
				.mock(javax.servlet.http.HttpSession.class);/*getParamInitForAbstract*/

		javax.servlet.http.HttpServletResponse HttpServletResponse_p_1 = Mockito
				.mock(javax.servlet.http.HttpServletResponse.class);/*getParamInitForAbstract*/

		javax.servlet.http.HttpServletRequest HttpServletRequest_p_2 = Mockito
				.mock(javax.servlet.http.HttpServletRequest.class);
		//成员变量设置

		//返回值定义 
		//该函数无返回值 
		/*getMethodParamInit*/
		/*getParamInitForCommon*/

		String Stringmock4_0 = "login_user";/*getMethodParamInit*/
		/*getParamInitForCommon*/

		javax.servlet.http.Cookie Cookiemock3_0 = UnitSpiritGsonUtil.getGson().fromJson(
				"{\"path\":\"/\",\"maxAge\":0,\"name\":\"S_L_ID\",\"httpOnly\":false,\"secure\":false,\"version\":0}",
				javax.servlet.http.Cookie.class);/*getMockResultForReturn*/
		/*getJsonDataReady*/

		Boolean mock_result_Boolean2 = false;
		PowerMockito.doReturn(mock_result_Boolean2).when(unitspirit_fixture)
				.checkData(Mockito.any(javax.servlet.http.HttpServletRequest.class));/*getMethodParamInit*/
		/*getParamInitForCommon*/

		String Stringmock1_0 = "/admin/login";

		PowerMockito.doNothing().when(HttpSession_p_0).removeAttribute(anyString());
		PowerMockito.doNothing().when(HttpServletResponse_p_1)
				.addCookie(Mockito.any(javax.servlet.http.Cookie.class));/*getInsideMock2*/
		/*generateMockAccessMethod*/

		PowerMockito.doNothing().when(HttpServletResponse_p_1).sendRedirect(anyString());

		unitspirit_fixture.logout(HttpSession_p_0, HttpServletResponse_p_1, HttpServletRequest_p_2);
		assertTrue(true);
	}
}
